vim.g.mapleader = " "

local keymap = vim.keymap

-- ---------- 插入模式 ---------- ---
keymap.set("i", "jk", "<ESC>")

-- ---------- 视觉模式 ---------- ---
-- 单行或多行移动
keymap.set("v", "J", ":m '>+1<CR>gv=gv")
keymap.set("v", "K", ":m '<-2<CR>gv=gv")

-- ---------- 正常模式 ---------- ---
-- 窗口
keymap.set("n", "<leader>sv", "<C-w>v") -- 水平新增窗口 
keymap.set("n", "<leader>sh", "<C-w>s") -- 垂直新增窗口

-- 取消高亮
keymap.set("n", "<leader>nh", ":nohl<CR>")

-- 切换buffer
keymap.set("n", "<leader>nn", ":bnext<CR>")
keymap.set("n", "<leader>np", ":bprevious<CR>")
keymap.set("n", "<leader>nw", ":bd<CR>")

-- ---------- 插件 ---------- ---
-- nvim-tree
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
-- ----------文件控制 ---------- ---
keymap.set("n", "<leader>w", ":w<CR>")
keymap.set("n", "<leader>q", ":q<CR>")
-- vim-sneak hotkey
keymap.set("n","f","<Plug>Sneak_s")
keymap.set("n","f","<Plug>Sneak_s")
keymap.set("o","f","<Plug>Sneak_s")
keymap.set("n","F","<Plug>Sneak_f")
-- fugitive
keymap.set("n","<leader>ga",":Git add .<CR>")
keymap.set("n","<leader>gc",":Git commit ")
keymap.set("n","<leader>gg",":Git<CR>")


